<!-- 权限管理 -->
<!--
orders
shelves
goodsmanager
tile
space
evaluation
set_goods_call_back_buff
qrcode
coupon
points
coupon
bina
visitorinfo
viplist
sendmail
assshop
storeinfo
setmap
themeimg
mainset
business
invite
permission
-->
<style>
	.permission .perm-item{
		background-color: #002D63;
	    color: #FFF;
	    border-radius: 8px;
	    padding: 0 8px;
	    margin: 1px 2px;
	}
</style>
<div class="permission">
	<div class="nav">
		<div class="nav-li focus">子账号管理</div>
	</div>
	<hr />
	<div class="box">
		<h3>子账号列表</h3>
		<br>
		<table class="paper-table">
			<thead>
				<td>子账号</td>
				<td>密码</td>
				<td>权限</td>
				<td>操作</td>
			</thead>
			{{#each $Cache.bus.permission.bus_child_list}}
			<tr>
				<td style="min-width:4em;text-align:center;">{{name}}</td>
				<td style="min-width:6em;text-align:center;">{{pwd}}</td>
				<td>
					{{#each perms}}
					<span class="perm-item">{{#MapName $This, $Top.$Cache.bus.permission.pers_name_map}}<!-- {{$Index==$Parent.length-1?'':', '}} --></span>
					{{/each}}
				</td>
				<td style="min-width:9em;text-align:center;">
					<button class="icon-pencil" event-click="{{'$Top.$Event.bus.permission.edit_info'}}">编辑信息</button>
					<button class="icon-remove2" event-click="{{'$Top.$Event.bus.permission.remove_employees'}}">删除账号</button>
				</td>
			</tr>
			{{/each}}
		</table>
		<hr>
		<h3>{{#if $Cache.bus.edit_permission._id}}编辑子账号
		<button event-click="{{'$Event.bus.edit_permission.new'}}">新建子账号</button>{{#else}}新建子账号{{/if}}</h3>
		<br>
		<android:input label="账号名" value="{{$Cache.bus.edit_permission.name}}" bind-input="{{'$Cache.bus.edit_permission.name'}}" description="开头无需书写“{{bus_loginer._id}}:”"></android:input>
		<android:input label="密码" value="{{$Cache.bus.edit_permission.pwd}}" bind-input="{{'$Cache.bus.edit_permission.pwd'}}"></android:input>
		<fieldset>
			<legend>权限控制</legend>
			<table class="paper-table">
			<thead>
				<td>业务管理</td>
				<td>营销管理</td>
				<td>商铺管理</td>
			</thead>
			<tr>
				<td style="vertical-align: top;text-align:left;padding-left: 3em;">
					{{#each $Cache.bus.permission.pers_name_map_by_type.业务管理}}
					<android:switch checked="{{#ArrayOwn $Top.$Cache.bus.edit_permission.perms, key}}" bind-input="{{'$Top.$Cache.bus.edit_permission.perms_map.'+key}}" event-change="{{'$Top.$Event.bus.edit_permission.change_perms'}}">{{value}}</android:switch>
					{{/each}}
				</td>
				<td style="vertical-align: top;text-align:left;padding-left: 3em;">
					{{#each $Cache.bus.permission.pers_name_map_by_type.营销管理}}
					<android:switch checked="{{#ArrayOwn $Top.$Cache.bus.edit_permission.perms, key}}" bind-input="{{'$Top.$Cache.bus.edit_permission.perms_map.'+key}}" event-change="{{'$Top.$Event.bus.edit_permission.change_perms'}}">{{value}}</android:switch>
					{{/each}}
				</td>
				<td style="vertical-align: top;text-align:left;padding-left: 3em;">
					{{#each $Cache.bus.permission.pers_name_map_by_type.商铺管理}}
					<android:switch checked="{{#ArrayOwn $Top.$Cache.bus.edit_permission.perms, key}}" bind-input="{{'$Top.$Cache.bus.edit_permission.perms_map.'+key}}" event-change="{{'$Top.$Event.bus.edit_permission.change_perms'}}">{{value}}</android:switch>
					{{/each}}
				</td>
			</tr>
			</table>
			<style>
			.permission fieldset .android-switch{
				  display: block;
			}
			.permission .perm-item{
				display: block;
				float: left;
			}
			</style>
		</fieldset>
		<br>
		<button event-click="{{'$Event.bus.edit_permission.lock'}}">提交</button>
		<br>
		<br>
	</div>
</div>